package com.mm.mindmap.controller;

import com.mm.common.annotation.Log;
import com.mm.common.domain.po.Result;
import com.mm.mindmap.domain.po.Reply;
import com.mm.mindmap.service.IReplyService;
import com.mm.mindmap.service.ReplyServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Slf4j
@RestController
@RequestMapping("/reply")
@RequiredArgsConstructor
@Api(tags = "评论相关接口")
public class ReplyController {

    private final ReplyServiceImpl replyService;

    @Log(name = "发送评论")
    @ApiOperation("发送评论")
    @PostMapping("/sendReply")
    public Result addReply(Reply reply){
        return replyService.sendReply(reply);
    }

    @Log(name = "获取所有评论")
    @ApiOperation("获取所有评论")
    @GetMapping("/getAllReply")
    public Result getReply(Long mid){
        return replyService.getAllReply(mid);
    }

}
